import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextInt()){
            int y = scanner.nextInt();
            int m = scanner.nextInt();
            int d = scanner.nextInt();
            int y1 = scanner.nextInt();
            int m1 = scanner.nextInt();
            int d1 = scanner.nextInt();
            if(y1<y){
                System.out.println("no");
            }else if(y1>y){
                System.out.println("yes");
            }else{
                if(m1<m){
                    System.out.println("no");
                }else if(m1>m) {
                    System.out.println("yes");
                }else{
                    if(d1<d){
                        System.out.println("no");
                    }else if(d1>d) {
                        System.out.println("yes");
                    }else{
                        System.out.println("yes");
                    }
                }
            }
        }
    }
}
